const http = require('../../../utils/util');
const Base64 = require('../../../utils/base');

Page({

    /**
     * 页面的初始数据
     */
    data: {
		page:1,  //分页
		otherList:[],
		isnext:true, //是否有下一页
    },
	
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
		this.getOtherData()
    },
	//获取其他数据
	getOtherData(){
		let data={
			user_id:wx.getStorageSync('user_id'),
			user_token:wx.getStorageSync('user_token'),
			page:this.data.page
		}
		http.post('user/other',Base64.encode(JSON.stringify(data))).then((res)=>{
			if(res.length==0){
				this.setData({
					isnext:false
				})
			}
			if(res.status==1){
				this.setData({
					otherList:[...this.data.otherList,...res.result]
				})
			}else{
				wx.showToast({
					title:'获取失败'
				})
			}
		})
	},
	
	
	
	
	//上拉触底
	 onReachBottom: function() {
	    if(this.data.isnext){
			this.setData({
				page:++this.data.page,
				otherList:[]
			})
			this.getOtherData()
		}
	  },
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})